package com.example.hellomp.config;

import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Contact;
import io.swagger.v3.oas.models.info.Info;
import org.springdoc.core.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class Knife4jConfiguration {
    @Bean
    public OpenAPI openApi(){
        Contact contact = new Contact();
        contact.name("盛茂国");
        contact.email("1620016116@qq.com");
        contact.url("http://hello-mp.io/doc.html");
        return new OpenAPI()
                .info(new Info()
                        .title("hello-mp-knife4j项目API")
                        .version("1.0")
                        .contact(contact)
                        .description("hello-mp-knife4j"));
    }

    @Bean
    public GroupedOpenApi userApi(){
        return GroupedOpenApi.builder().group("用户信息管理")
                .pathsToMatch("/user/**")
                .build();
    }

    @Bean
    public GroupedOpenApi systemApi(){
        return GroupedOpenApi.builder()
                .group("产品信息管理")
                .pathsToMatch("/product/**")
                .build();
    }

    @Bean
    public GroupedOpenApi goodApi(){
        return GroupedOpenApi.builder()
                .group("商品信息管理")
                .pathsToMatch("/goods/**")
                .build();
    }


}
